<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>hello vue组件-全局组件</title>
    <link rel="stylesheet" type="text/css" href="./lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="./css/vue2-animate.css" type="text/css">

    <script type="text/javascript" src="./lib/vue/vue.js"></script>
    <script type="text/javascript" src="./lib/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/bootstrap/js/bootstrap.js"></script>
    <style>

    </style>

</head>

<body>
    
    <div id="box" class="container">
        <h1>子组件要正常工作，必须存在于父组件的模板中...!!!!!</h1>
        <cp1>
            
        </cp1>
    </div>

</body>


<script>
    var v = new Vue({
        el: '#box',
        components: {
            'cp1': { // 组件ID不能与html tag同名
                template: '<div><h2>父组件：aaaaaa</h2><cp11></cp11></div>',
                data() {
                    return {
                        'age': 33
                    }
                },
                components: {
                    'cp11': {
                        template: '<h5>自组件：bbbbbbbb</h5>'
                    }
                }
            }
        }

    });
</script>

</html>